package com.atguigu.gmall.product.client;

import com.atguigu.gmall.model.product.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Author: 李旭
 * @Time: 10:30
 * @Description:
 */
@FeignClient(name = "service-product",fallback = DegradedProductFeignClient.class)
public interface ProductFeignClient {

    //1、skuInfo  库存信息 SkuInfo图片  /inner 字样表示是内部资源 不允许外来的请求访问  网关全局过滤器
    @GetMapping("/api/product/inner/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable Long skuId);
    //2、一二三级分类
    @GetMapping("/api/product/inner/getBaseCategoryView/{category3Id}")
    public BaseCategoryView getBaseCategoryView(@PathVariable Long category3Id);

    //3、销售属性及值及选中红边框
    @GetMapping("/api/product/inner/getSpuSaleAttrValueChecked/{skuId}/{spuId}")
    public List<SpuSaleAttr> getSpuSaleAttrValueChecked(@PathVariable Long skuId,
                                                        @PathVariable Long spuId);
    //4、销售属性值组合对应库存ID    入参：商品ID spuId
    @GetMapping("/api/product/inner/getValuesSkuJson/{spuId}")
    public Map getValuesSkuJson(@PathVariable Long spuId);

    //5：单独查询价格 不放在缓存中
    @GetMapping("/api/product/inner/getPrice/{skuId}")
    public BigDecimal getPrice(@PathVariable Long skuId);

    //查询三级分类视图集合
    @GetMapping("/api/product/inner/getBaseCategoryViewList")
    public List<BaseCategoryView> getBaseCategoryViewList();

    //根据主键查询品牌对象
    @GetMapping("/api/product/inner/getBaseTrademark/{id}")
    public BaseTrademark getBaseTrademark(@PathVariable Long id);

    //查询ES索引库所需要的平台属性ID及名称及值
    @GetMapping("/api/product/inner/getSkuAttrValue/{skuId}")
    public List<SkuAttrValue> getSkuAttrValue(@PathVariable Long skuId);
}
